﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.ServiceModel;
using System.Text;

using LinFu.IoC.Configuration;
using System.Collections;

namespace CoreEx.Wcf.Server.Tests
{
   
    public interface ICustomerManager
    {                
        IList<ICustomer> GetCustomers();               
        IList<T> GetItemOfT<T>();
        IList GetCustomer();
        //IList<T> Find<T>(Expression<Func<T>> expression);
    }

    //IList<ICustomer> Find(Expression<Func<ICustomer>> expression);
    [Implements(typeof(ICustomerManager))]
    public class CustomerManager : ICustomerManager
    {
        public IList<ICustomer> GetCustomers()
        {
            Customer customer1 = new Customer() { Name = "Sam" };
            Customer customer2 = new Customer() { Name = "Jane" };
            return new List<ICustomer>(new ICustomer[] { customer1, customer2 });
        }

        public IList<T> Find<T>(Expression<Func<T>> expression)
        {
            return new List<T>();
        }

        public IList<T> GetItemOfT<T>()
        {
            Customer customer1 = new Customer() { Name = "Sam" };
            Customer customer2 = new Customer() { Name = "Jane" };
            
            List<T> list = new List<T>();
            list.Add((T)(object)customer1);
            list.Add((T)(object)customer2);
            return list;
        }

        public IList GetCustomer()
        {
            Customer customer1 = new Customer() { Name = "Sam" };
            Customer customer2 = new Customer() { Name = "Jane" };
            return new List<ICustomer>(new ICustomer[] { customer1, customer2 });
        }
    }
}